<template>
	<section> 
		<el-row class="app-container">
			<!--新增界面 Archive 档案信息表--> 
			<el-form :model="editForm"  label-width="120px" ref="editForm" class="paddingToCenter"> 
				<el-row label=""  prop="archiveTitle">
					<h1>{{editForm.archiveTitle}}</h1> 
				</el-row>
				<el-row label="" prop="tagNames" class="line">  
					<el-col :span="6" class="lineHeight mlToNull">
						<el-tag
						  :key="tag"
						  v-for="tag in dynamicTags" 
						  :disable-transitions="false" >
						  {{tag}}
						</el-tag> 
					</el-col>
					<el-col :span="6"  class="lineHeight mlToNull">{{editForm.createDate}}</el-col>
					<el-col :span="6"  class="lineHeight mlToNull">作者：{{editForm.authorName}}</el-col>   
				</el-row> 
				<el-row v-if="editForm.archiveAbstract!=null && editForm.archiveAbstract!=''" label="" prop="archiveAbstract"> 
					<div v-html="editForm.archiveAbstract"></div> 
				</el-row> 
				
				<el-row label="" prop="archiveContext" > 
					 <div v-loading="load.list" v-html="editForm.archiveContext"></div>
				</el-row>   
				<comments v-if="editForm && editForm.id" :archive-id="editForm.id" :is-mng="isMng"></comments>
			</el-form>
		</el-row>
	</section>
</template>

<script>
 
	import { queryArchiveById  } from '@/api/mdp/arc/archive/archive';
 	import Comments from '../archiveComment/Tree';  
	
	export default {
		watch: { 
	    },	
		data() {
			return {
 				load:{ list:false, open:false, close:false, publish:false, unPublish:false, del:false },
 
				//新增界面数据 档案信息表
				editForm: {
					id:'',tagNames:'',deptid:'',userid:'',isShare:'',url:'',archiveAbstract:'',archiveContext:'',archiveTitle:'',archivingUserid:'',isFromArchiving:'',archivingDate:'',createDate:'',authorUserid:'',authorName:'',canDel:'',canEdit:'',canRead:'',bizKey:'',encryptType:'',canComment:'1',status:'0',isStorageDir:''
				},
				/**begin 在下面加自定义属性,记得补上面的一个逗号**/  
				dynamicTags: [],  
 		        isMng:'0'
				/**end 在上面加自定义属性**/
			}//end return
		},//end data
		methods: { 
			  
			
		},//end method
		components: {      
		     'comments':Comments
		},
		mounted() { 
			this.$nextTick(() => {
				if(this.$route.query.isMng){
					this.isMng=this.$route.query.isMng
				}
				let params = {}; 
				if(this.$route.params.id){ 
					params.id = this.$route.params.id
				}else{
					params.id=this.archive.id
				} 
				this.load.list=true
				queryArchiveById(params).then(res=>{
					 this.load.list=false
					 if(!res.data.data){
						this.$message.error("文章已不存在");
						return;
					 }
					 this.editForm=res.data.data
					 if( this.editForm.tagNames!=null && this.editForm.tagNames!=='' ){
						 this.dynamicTags=this.editForm.tagNames.split(",");
					 } 
				  }).catch(e=>this.load.list=false)    
        	});
			 
			/**在下面写其它函数***/
			
		}//end mounted
	}

</script>

<style scoped>
	.paddingToCenter{
		padding-left: 80px;
   	 	padding-right: 80px;
	}
	.mlToNull{
		margin-left:0px;
	}
	
	.line{
		border-bottom: 1px solid #ccc;
	    border-top: 1px solid #ccc;
	    height: 60px;
	    margin-bottom: 20px;
	}
	.lineHeight{
		line-height: 50px;
	}
</style>